import 'dart:math';

extension E on List<double> {
  double standardDeviation() {
    if (length <= 1) return 0;
    final mean = reduce((double a, double b) => a + b) / length;
    num variance = map((x) => pow(x - mean, 2)).reduce((a, b) => a + b);
    double standardDeviation = sqrt(variance / length);
    return standardDeviation;
  }
}
